/*
 * version date author 
 * ────────────────────────────────── 
 * 1.0  2013-11-8 Neal Miao 
 * 
 * Copyright(c) 2013, by htwater.net. All Rights Reserved.
 */
package cn.miao.photoprinter.util;

import android.content.Context;
import android.os.Build;
import android.widget.Toast;
import cn.miao.photoprinter.view.TipsToast;

/**
 * 
 * 
 * @author Neal Miao
 * @version
 * @since v 1.0
 * @Date 2013-11-8 上午10:33:10
 * 
 * @see
 */
public class ToastUtil {

	public static TipsToast tipsToast;

	public static TipsToast showTips(Context context, int iconResId, int msgResId) {
		if (tipsToast != null) {
			if (Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
				tipsToast.cancel();
			}
		}
		tipsToast = TipsToast.makeText(context, msgResId, Toast.LENGTH_SHORT);
		tipsToast.show();
		tipsToast.setIcon(iconResId);
		tipsToast.setText(msgResId);
		return tipsToast;
	}

	public static void showTips(Context context, int iconResId, String msg) {
		showTips(context, iconResId, msg, Toast.LENGTH_SHORT);
	}

	public static TipsToast showTips(Context context, int iconResId, String msg,
			int length) {
		if (tipsToast != null) {
			if (Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
				tipsToast.cancel();
			}
		}
		tipsToast = TipsToast.makeText(context, msg, length);
		tipsToast.show();
		tipsToast.setIcon(iconResId);
		return tipsToast;
	}
}
